package cn.oa.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.oa.bean.Attendance;
import cn.oa.service.AttendanceService;

@Controller
public class AttendanceController {
	@Resource
	private AttendanceService attendanceService;
	
	@GetMapping("/attendance")
	public String findAttendance(ModelMap map,Attendance attendance
			,@RequestParam(required=false,defaultValue="1")int pageNum
			,@RequestParam(required=false,defaultValue="10")int pageSize) {
		PageHelper.startPage(pageNum,pageSize);
		List<Attendance> list = attendanceService.find(attendance);
		map.addAttribute("pageInfo", new PageInfo<>(list));
		return "attendance-list";
	}
	
	
	
}
